package com.itheima.controller.admin;

import com.itheima.common.entity.PageResult;
import com.itheima.common.entity.Result;
import com.itheima.dto.OrderDTO;
import com.itheima.dto.OrderPageQueryDTO;
import com.itheima.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 预约管理
 */
@RestController
@RequestMapping("/order")
@Slf4j
public class OrderController {
    @Autowired
    private OrderService orderService;
    /**
     * 分页查询
     */
    @PostMapping("/findPage")
    public PageResult page(@RequestBody OrderPageQueryDTO orderPageQueryDTO) {
        log.info("套餐分页查询的条件:{}",orderPageQueryDTO);
        PageResult pageResult = orderService.pageQuery(orderPageQueryDTO);
        return pageResult;
    }
    /**
     * 修改状态
     */
    @PostMapping("/update")
    public Result update(@RequestBody OrderDTO orderDTO) {
          orderService.updateOrderStatus(orderDTO);
        return Result.success("修改预约状态成功");
    }


}
